How to put a
search and results page set on the same page
Product:
UltraDev
Platform:
All
Versions:
all
ID:
15906
A common question among UltraDev developers is how to create a
search page where the results of the search are displayed on the search
page instead of on another page. While there are many different ways of implementing a
search with the results on the same page, this TechNote discusses one
possible solution using ASP.
How to
setup the search/results page:
1
Create a
search page that includes a form and the necessary form elements. In
the Property inspector, set the form method to GET and enter the
filename of the search page into the action field (e.g.:
search.asp). Here is how the HTML code should look:
<form method="get" action="search.asp">
2
Create a
Recordset by choosing Window > Data Bindings > click on the
plus (+) button > Recordset (Query).
3
Select the Simple
view of the Recordset dialog box. In the filter section's first drop
down menu, select the column name from the table used as the search
criteria. The next drop down menu should be set to equals (=) and
the third drop down menu should be set to "URL Parameter". The last
box should be the variable ("fn") from your search.asp page, where
"fn" is the name of the text field (<input type="text"
name="fn">). See the screen shot below for reference:
4
Switch
the Recordset view from Simple to Advanced. In the Variables
section, enter the word "blank" as the Default Value and click the
OK button to close the Recordset dialog box. See the screen shot
below for reference:
Note: The word "blank" is arbitrary. The
word "blank" was chosen in this example so that no records will be
displayed in the results section when the page loads initially with
the default value.
5
Create a table on
your search.asp page. Open the recordset by choosing Window >
Data Bindings > click the plus (+) icon next to the Recordset
(Query) to expand the recordset. Drag the recordset fields into the
appropriate table cells.
6
Click anywhere in
the table and choose the <table> tag from the UltraDev
tag selector. Open the Server Behaviors panel and apply the Show
Region > Show Region If Recordset Is Not Empty (UltraDev 4)
server behavior. If you are using UltraDev 1, use Hide Region >
If Recordset is Empty.
7
Save the
search.asp page, upload it to the remote site and test it in a Web
browser.
Note: The Show Region (Hide Region in
UltraDev 1) server behavior is used to hide the results table until the
user has entered a value in the search form.